package com.yunhe.merchants;

import com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration;
import com.yunhe.common.filter.ServerContextFilter;
import com.yunhe.common.interceptor.ServerContextInterceptor;
import feign.RequestInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;

/**
 * @Author: DongWenYu
 * @Date: 2021/4/28 14:43
 */
@SpringBootApplication(exclude = PageHelperAutoConfiguration.class)
@MapperScan("com.yunhe.merchants.repository")
@EnableFeignClients(basePackages = {"com.yunhe"})
@ComponentScan(basePackages = {"com.yunhe"})
public class MerchantsServerApplication {
    public static void main(String[] args) {
            SpringApplication.run(MerchantsServerApplication.class , args);
        }

    /**注册  Feign拦截器*/
    @Bean
    public RequestInterceptor serverContextInterceptor(){
        return new ServerContextInterceptor();
    }

    /**注册过滤器*/
    @Bean
    public ServerContextFilter serverContextFilter() {
        return new ServerContextFilter();
    }
}
